﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 爬虫2号
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string url;
        string inageutl;
        private void Form1_Load(object sender, EventArgs e)
        {
            HttpWebRequest request = HttpWebRequest.Create("http://ss8.pm/") as HttpWebRequest;
            request.Method = "get";
            request.AllowAutoRedirect = false;
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            url = response.GetResponseHeader("Location").ToString();
            inageutl = url + "images/server01.png";
            pictureBox1.ImageLocation = inageutl;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (inageutl!=(url + "images/server01.png"))
            {
                inageutl = url + "images/server01.png";
                pictureBox1.ImageLocation = inageutl;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (inageutl != (url + "images/server02.png"))
            {
                inageutl = url + "images/server02.png";
                pictureBox1.ImageLocation = inageutl;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (inageutl != (url + "images/server03.png"))
            {
                inageutl = url + "images/server03.png";
                pictureBox1.ImageLocation = inageutl;
            }
        }
    }
}
